﻿
using System;
using System.Collections.Generic;

namespace GeoAPI.Indexing
{
    public interface ISpatialIndexNode<TBounds, TItem> : IBoundable<TBounds>
        where TItem : IBoundable<TBounds>
    {
        void AddChild(ISpatialIndexNode<TBounds, TItem> child);
        void AddChildren(IEnumerable<ISpatialIndexNode<TBounds, TItem>> children);
        void AddItem(TItem item);
        void AddItems(IEnumerable<TItem> items);
        TBounds Bounds { get; }
        Int32 ChildCount { get; }
        Int32 ItemCount { get; }
        IEnumerable<TItem> Items { get; }
        IEnumerable<ISpatialIndexNode<TBounds, TItem>> Children { get; }
        Boolean IsEmpty { get; }
        Boolean IsLeaf { get; }
        Boolean IsPrunable { get; }
        Boolean HasItems { get; }
        Boolean HasChildren { get; }
        Boolean RemoveItem(TItem item);
        Boolean RemoveChild(ISpatialIndexNode<TBounds, TItem> child);
        IEnumerable<TItem> Query(TBounds query);
        IEnumerable<TItem> Query(TBounds query, Predicate<TItem> predicate);
        IEnumerable<TResult> Query<TResult>(TBounds query, Func<TItem, TResult> predicate);
        /// <summary>
        /// Gets the count of items in this node and all subnodes.
        /// </summary>
        Int32 TotalItems { get; }
        Int32 TotalNodes { get; }
    }
}
